#include "includes.h"


unsigned long int num;


int main(void){
	
	unsigned char n=0;
	unsigned char old_state=0,new_state=0;
	unsigned char duty_on=0,duty_off=0;
	DDRA = 0x00;
	DDRC = 0xff;
	PORTC = 0x00;
	DDRB=0xff;
	PORTB=0x00;
	
	
	timer_init();
	
	while(1){
	old_state = new_state;
	new_state = PINA&0x01;
	if((new_state != old_state)&&(new_state == 0x01)){
		TCNT0 = 0;
		while(PINA&0x01);
		duty_on = TCNT0;
		PORTB = duty_on;
		TCNT0 = 0;
		while(!(PINA&0x01));
		duty_off = TCNT0;
		PORTC = duty_off;
	}
	
	}
    return 0;
}
